package test.gateway.a.controllers;

import com.sanri.dtos.IdcardQueryParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class ComplexDtoController {

    @GetMapping("/idcard")
    public String idcard(@RequestBody IdcardQueryParam complexDto){
        log.info("当前收到的数据为:{}",complexDto);
        return complexDto.getName()+":"+complexDto.getAge()+":430124";
    }

    @GetMapping("/idcard/echo")
    public String idcard(IdcardQueryParam complexDto,String echo){
        if(complexDto != null){
            return idcard(complexDto);
        }
        return echo;
    }
}
